$server = 'http://localhost:8080/';

window.onload = function(){
	$orderNo = GetQueryString('orderNo');
	$.ajax(
	{
		url: $server+'order/detail.do',
		type: "POST",
		data:{orderNo : $orderNo},
		datatype: 'json',		
		crossDomain:true, //设置跨域为true
		xhrFields:{
			withCredentials: true // 携带跨域cookie
		},
		success: function(result){
			if (result.code == 200 && result.data != undefined){
				$('#orderNo')[0].innerHTML = result.data.orderNo;
				$('#shouldPrice')[0].innerHTML = result.data.payment;
				$('#totalPriceBottom')[0].innerHTML = result.data.payment;
			}else{
				alert('订单不存在!!!');
				window.location.href = 'index.html';
			}
		},
	});
}

// 从地址栏获取参数
function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = decodeURI(window.location.search.substr(1)).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}